package com.example;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

public class MyClass {

    public static void main(String args[]) throws Exception {
        //数据库版本号，包名（生成greendao的位置）
        int version = 1;
        String packName = "com.gjb6.master.messageDao";
        Schema schema = new Schema(version,packName);
        //创建一个实体
        initMessageTable(schema);
        //生成的目录
        new DaoGenerator().generateAll(schema,"app/src/main/java");

    }

    private static void initMessageTable(Schema schema) {
        //创建message的表  的实体
        Entity message = schema.addEntity("Message");
        //给表添加一个ID
        message.addIdProperty();
        //通过实体来添加表的内容
        //添加String类型
        message.addStringProperty("type");
        message.addStringProperty("data");

        Entity userBeans = schema.addEntity("UserBeans");
        userBeans.addIdProperty();
        userBeans.addStringProperty("type");
        userBeans.addIntProperty("data");

        //创建保存对方消息头像和名称的表
        Entity info = schema.addEntity("Info");
        info.addIdProperty();
        info.addStringProperty("phone");
        info.addStringProperty("name");
        info.addStringProperty("portrait");
    }
}